/*
 * PointBrush.java	1.0  01/02/2006
 * PointBrush.java	2.0  10/02/2008
 *
 * This class is the brush drawing point patterns
 * Author:    Isabelle Bichindaritz
 *
 */

import java.awt.*;
import java.nio.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;


public class PointBrush extends Brush {

	public void brushBegin (Point source, Point target, GLAutoDrawable drawable) {
		// initiates brush movement by setting the point size from Painter slider
		int size = Painter.size;

		final GL gl = drawable.getGL();
		final GLU glu = new GLU();
		//System.out.println ("PointBrush brushBegin Size=" + size);
		gl.glPointSize ((float) size);
		brushMove (source, target, drawable);	
	}

	public void brushMove (Point source, Point target, GLAutoDrawable drawable) {
		// continues brush movement by copying the color from the original picture 
		// to the current mouse position 
		final GL gl = drawable.getGL();
		final GLU glu =  new GLU();
		if (Painter.imageRGBA == null) {
			System.out.println ("PointBrush picture is NULL");
		}
		else
		{
			gl.glBegin (GL.GL_POINTS);
			setColor (source, drawable);
			gl.glVertex2d (target.getX(), target.getY());
			gl.glEnd(); 
		}
	}

	public void brushEnd (Point source, Point target) {
		// ends the brush movement
		int size = Painter.size;

	}


	//----------------------------------------------------
	// This brush draws points
	//----------------------------------------------------

} // end PointBrush class